Auto page size based on content size · Issue #1627 · wkhtmltopdf/wkhtmltopdf · GitHub 您所在的位置:网站首页 solved change pagecount for dynamic form Auto page size based on content size · Issue #1627 · wkhtmltopdf/wkhtmltopdf · GitHub

Auto page size based on content size · Issue #1627 · wkhtmltopdf/wkhtmltopdf · GitHub

2023-08-05 09:32| 来源: 网络整理| 查看: 265

One aspect of unlimited page length is that, while pages are built from the top down, the coordinate system runs from the bottom up. Thus, the y-coordinate of the top of the page needs to be known when you start. It's too bad that Adobe chose to do this (almost every other graphics system has y=0 at the top). That's no problem for a fixed media size, but trying to build a page of unknown media length means that sooner or later you will go negative on your coordinates. You would need to make a second pass to update all y-coordinates to have y=0 at the bottom of the long page (as well as reset the MediaBox). The alternatives include making a regular first pass (normal media size) and determining the total length at the end, then making a second pass with the extended media size; or making a wkHTMLtoImage pass first to determine media size; or somehow gluing together regular pages into one; or simply oversizing the media and cropping the result afterwards. You might also be able to use a flipped coordinate system (y=0 at the top) and either make a second pass through to update/correct it, or use the cm operator to flip the coordinate system.

Don't forget that PDF officially limits you to 14400 points, unless you use a UserUnits scale factor. I think a lot of readers are lax in enforcing that rule, but you never know when you'll run into one that is strict about it.



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有